#include "StdAfx.h"
#include "OpenBottom.h"
#include "GameLogic.h"
#include "Card.h"

COpenBottom::COpenBottom(void)
{
}

COpenBottom::~COpenBottom(void)
{
}

void COpenBottom::Render(CDC *pDC)
{
	if(g_imgBottomSprite.IsValid())
	{
		int nImgWidth = g_imgBottomSprite.GetWidth() / OpenBottom_Frame_Count;
		int nImgHeight = g_imgBottomSprite.GetHeight();

		int nImgCardWidth = g_imgCard.GetWidth() / CardImage_Col_Count;
		int nImgCardHeight = g_imgCard.GetWidth() / CardImage_Row_Count;

		int nOffsetWidth = m_nWidth / 3;
		for(int i = 0; i < Bottom_Card_Count; i++)
		{
			CRect rcDst(m_nCurPosX + i * nOffsetWidth, m_nCurPosY, m_nCurPosX + i * nOffsetWidth + nImgCardWidth, m_nCurPosY + g_imgCard.GetWidth() / CardImage_Col_Count);
			CRect rcSrc(m_nCurFrame * nImgWidth, 0, m_nCurFrame * nImgWidth + nImgWidth, nImgHeight);
			g_imgBottomSprite.DrawPart(pDC->m_hDC, rcDst, rcSrc);
		}
	}
}